<template>
  <div class="table-container">
    <div class="notification-list">
      <ul>
        <li v-for="(item, index) in notifications" :key="index" @click="openAttachment(item.attachmentUrl)">
          <span class="number">{{ index + 1 }}.</span>
          {{ item.text }}
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TzGg',
  data() {
    return {
      notifications: [
        { text: "【重庆市科技局】关于下达2024年度重庆市第十批科研项目计划的通知", attachmentUrl: "https://tse3-mm.cn.bing.net/th/id/OIP-C.TqS8gDIOtmSqhw4e8wM5_gHaNL?w=203&h=327&c=7&r=0&o=5&pid=1.7" },
        { text: "【四川省科学技术厅】关于开展2024年度四川省科学技术奖提名工作的通知", attachmentUrl: "https://ts2.cn.mm.bing.net/th?id=OPAC.GxBP2dYOqHmcyQ474C474&o=5&pid=21.1&h=157&w=300&c=4&rs=1" },
        { text: "关于表彰2024年度中国电建科学技术奖获奖项目的通知", attachmentUrl: "https://ts2.cn.mm.bing.net/th?id=OPAC.GxBP2dYOqHmcyQ474C474&o=5&pid=21.1&h=157&w=300&c=4&rs=1" },
        { text: "关于印发2024年度中国电力股份有限公司重点科技项目立项评审意见的通知", attachmentUrl: "https://ts2.cn.mm.bing.net/th?id=OPAC.GxBP2dYOqHmcyQ474C474&o=5&pid=21.1&h=157&w=300&c=4&rs=1" },
        { text: "关于规范公司专利申请中非正常专利风险的通知", attachmentUrl: "path/to/attachment5.pdf" },
        { text: "关于印发《中国水利水电第五工程局有限公司研发费用管理实施细则》的通知", attachmentUrl: "path/to/attachment6.pdf" },
        { text: "关于规范技术合同签订事项的通知", attachmentUrl: "path/to/attachment7.pdf" },
        { text: "关于印发《中国水利水电第五工程局有限公司研发费用管理方案》的通知", attachmentUrl: "path/to/attachment8.pdf" },
        { text: "2023年度科技系统优秀人员评选结果公示", attachmentUrl: "path/to/attachment9.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment10.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment11.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment12.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment13.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment14.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment15.pdf" },
        { text: "关于下达公司2024年度科研项目实施计划的通知", attachmentUrl: "path/to/attachment16.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "周树人", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "蔡徐坤", attachmentUrl: "path/to/attachment17.pdf" },
        { text: "啊", attachmentUrl: "path/to/attachment17.pdf" },
      ]
    };
  },
  methods: {
    openAttachment(url) {
      if (url) {
        window.open(url, '_blank'); // 在新标签页中打开附件
      } else {
        alert('没有附件可打开');
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.table-container {
  max-height: 400px; // 设置最大高度
  overflow-y: auto; // 启用垂直滚动条
  -webkit-overflow-scrolling: touch; // iOS 平滑滚动
}

.notification-list {
  list-style-type: none;
  margin-left: 0;
  padding-left: 0;
}

.number {
  color: #007BFF;
  font-size: 1.2em;
  font-weight: bold;
  margin-right: 5px;
}

li {
  line-height: 1.5em;
  cursor: pointer; // 鼠标悬停时显示指针
  transition: background-color 0.3s;

  &:hover {
    background-color: #f0f0f0; // 鼠标悬停时改变背景色
  }
}
.table-container[data-v-09c11f12] {
  max-height: 700px !important;
}
.table-container::-webkit-scrollbar {
  width: 4px; // 滚动条宽度
}

.table-container::-webkit-scrollbar-track {
  border-radius: 10px; // 滚动条轨道的圆角
  background-color: #e0e0e0; // 轨道背景颜色
}

.table-container::-webkit-scrollbar-thumb {
  border-radius: 10px; // 滚动条滑块的圆角
  background-color: #5bc0de; // 滑块背景颜色
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); // 滑块阴影效果
}

/* 响应式设计 */
//67%
@media screen and (min-width: 2801px) and (max-width: 2900px) {
  .table-container {
    height: 600px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 2701px) and (max-width: 2800px) {
  .table-container {
    height: 580px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 2601px) and (max-width: 2700px) {
  .table-container {
    height: 550px;
    //border: 1px solid #f00;
  }
}
//75%
@media screen and (min-width: 2501px) and (max-width: 2600px) {
  .table-container {
    height: 520px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 2401px) and (max-width: 2500px) {
  .table-container {
    height: 500px;
    //border: 1px solid #f00;
  }
}
//80%
@media screen and (min-width: 2301px) and (max-width: 2400px) {
  .table-container {
    height: 470px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 2201px) and (max-width: 2300px) {
  .table-container {
    height: 450px;
    //border: 1px solid #f00;
  }
}
//90%
@media screen and (min-width: 2101px) and (max-width: 2200px) {
  .table-container {
    height: 420px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 2001px) and (max-width: 2100px) {
  .table-container {
    height: 390px;
    //border: 1px solid #f00;
  }
}
//100%
@media screen and (min-width: 1901px) and (max-width: 2000px) {
  .table-container {
    height: 370px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 1801px) and (max-width: 1900px) {
  .table-container {
    height: 350px;
    //border: 1px solid #f00;
  }
}
//110%
@media screen and (min-width: 1701px) and (max-width: 1800px) {
  .table-container {
    height: 330px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 1601px) and (max-width: 1700px) {
  .table-container {
    height: 300px;
    //border: 1px solid #f00;
  }
}
//125%
@media screen and (min-width: 1501px) and (max-width: 1600px) {
  .table-container {
    height: 280px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 1401px) and (max-width: 1500px) {
  .table-container {
    height: 280px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 1301px) and (max-width: 1400px) {
  .table-container {
    height: 250px;
    //border: 1px solid #f00;
  }
}
//150%
@media screen and (min-width: 1201px) and (max-width: 1300px) {
  .table-container {
    height: 220px;
    //border: 1px solid #f00;
  }
}
@media screen and (min-width: 1101px) and (max-width: 1200px) {
  .table-container {
    height: 190px;
    //border: 1px solid #f00;
  }
}

@media screen and (min-width: 1001px) and (max-width: 1100px) {
  .table-container {
    height: 160px;
    //border: 1px solid #f00;
  }
}



@media screen and (max-width: 767px) {
  .table-container {
    height: 130px;
    //border: 1px solid #f00;
  }
}
</style>
